<?php

/**
 * RoleTasks form base class.
 *
 * @method RoleTasks getObject() Returns the current form's model object
 *
 * @package    maximous
 * @subpackage form
 * @author     Mina.Gerges.Wadea
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseRoleTasksForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'                 => new sfWidgetFormInputHidden(),
      'role_id'            => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Role'), 'add_empty' => false)),
      'site_component_id'  => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('SiteComponent'), 'add_empty' => false)),
      'view_task'          => new sfWidgetFormInputCheckbox(),
      'add_task'           => new sfWidgetFormInputCheckbox(),
      'edit_task'          => new sfWidgetFormInputCheckbox(),
      'delete_task'        => new sfWidgetFormInputCheckbox(),
      'check_task'         => new sfWidgetFormInputCheckbox(),
      'change_status_task' => new sfWidgetFormInputCheckbox(),
      'created_at'         => new sfWidgetFormDateTime(),
      'updated_at'         => new sfWidgetFormDateTime(),
    ));

    $this->setValidators(array(
      'id'                 => new sfValidatorChoice(array('choices' => array($this->getObject()->get('id')), 'empty_value' => $this->getObject()->get('id'), 'required' => false)),
      'role_id'            => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Role'))),
      'site_component_id'  => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('SiteComponent'))),
      'view_task'          => new sfValidatorBoolean(array('required' => false)),
      'add_task'           => new sfValidatorBoolean(array('required' => false)),
      'edit_task'          => new sfValidatorBoolean(array('required' => false)),
      'delete_task'        => new sfValidatorBoolean(array('required' => false)),
      'check_task'         => new sfValidatorBoolean(array('required' => false)),
      'change_status_task' => new sfValidatorBoolean(array('required' => false)),
      'created_at'         => new sfValidatorDateTime(),
      'updated_at'         => new sfValidatorDateTime(),
    ));

    $this->widgetSchema->setNameFormat('role_tasks[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'RoleTasks';
  }

}
